import { createApp } from 'vue'
import App from '@/App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import 'virtual:svg-icons-register'
//@ts-ignore 忽略当前文件ts类型的检测否则有红色提示(打包会失败)
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
// 引入模版全局样式
import '@/styles/index.scss'
// 引入自定义插件对象
import gloalComponent from '@/components/index.ts'
// 测试代码，测试假接口是否能使用
import axios from 'axios'
// 路由
import router from './router'
// 引入仓库
import pinia from './store'
// 引入路由鉴权
import './permisstion'
// 暗黑模式需要样式
import 'element-plus/theme-chalk/dark/css-vars.css'
import { isHasButton } from '@/directive/has.ts'

// 登录接口
axios({
  url: '/api/user/login',
  method: 'post',
  data: {
    username: 'admin',
    password: '111111',
  },
})
console.log(gloalComponent)

const app = createApp(App)
// 安装自定义插件
app.use(gloalComponent)
// 注册路由
app.use(router)
isHasButton(app)
// 安装仓库
app.use(pinia)
app.use(ElementPlus, {
  locale: zhCn,
})
app.mount('#app')
